package cn.tedu.boyou.search.query;

import cn.tedu.boyou.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;


@Getter
@Setter
@ToString
public class AnswerQueryObject extends QueryObject{

    private String orderBy = "viewnum";//排序

    private Long destId = -1L;    //目的地id
    public Pageable getPageable(){
        PageRequest of = PageRequest.of(super.getCurrentPage() - 1, super.getPageSize(), Sort.Direction.DESC, orderBy);
        return of;
    }
    public Pageable getPageableWithoutSort(){
        PageRequest of = PageRequest.of(super.getCurrentPage() - 1, super.getPageSize());
        return of;
    }
}
